﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyVoteMVC.Domain
{
    public class VT_Users
    {
        public VT_Users()
        {
            Tickets = new List<VT_Tickets>();
        }
        /// <summary>
        /// PK Guid
        /// </summary>
        public string User_ID { get; set; }

        /// <summary>
        /// 用户名(唯一)
        /// </summary>
        public string User_Name { get; set; }

        /// <summary>
        /// 用户名(不唯一)
        /// </summary>
        public string User_RealName { get; set; }

        /// <summary>
        /// 用户邮箱地址(唯一)
        /// </summary>
        public string User_Email { get; set; }

        /// <summary>
        /// 用户密码
        /// </summary>
        public string User_Password { get; set; }

        /// <summary>
        /// 是否管理员
        /// </summary>
        public int? User_IfAdminValue { get; set; }
        public UserType User_IfAdmin
        {
            get
            {
                return (UserType)User_IfAdminValue;
            }
            set
            {
                User_IfAdminValue = (int)value;
            }
        }
        /// <summary>
        /// 是否领导
        /// </summary>
        public int? User_IfLeaderValue { get; set; }
        public UserRole User_IfLeader
        {
            get
            {
                return (UserRole)User_IfLeaderValue;
            }
            set
            {
                User_IfLeaderValue = (int)value;
            }
        }

        /// <summary>
        /// 创建人
        /// </summary>
        public string Created_By { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? Created_Date { get; set; }

        /// <summary>
        /// 创建方法
        /// </summary>
        public string Created_Action { get; set; }

        /// <summary>
        /// 更新人
        /// </summary>
        public string Last_Update_By { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? Last_Update_Date { get; set; }

        /// <summary>
        /// 更新方法
        /// </summary>
        public string Last_Update_Action { get; set; }

        //LazyLoad
        /// <summary>
        /// 用户相关的票据
        /// </summary>
        public virtual ICollection<VT_Tickets> Tickets { get; set; }

    }

    /// <summary>
    /// 用户类型
    /// </summary>
    public enum UserType
    {
        /// <summary>
        /// 普通用户
        /// </summary>
        User = 0,
        /// <summary>
        /// 管理员用户
        /// </summary>
        Admin = 1
    }

    /// <summary>
    /// 用户角色
    /// </summary>
    public enum UserRole
    {
        /// <summary>
        /// 经办人
        /// </summary>
        Transactor = 0,
        /// <summary>
        /// 领导
        /// </summary>
        Leader = 1
    }
}
